import Vue from 'vue'
import App from './App'
import uView from 'uview-ui'
import store from 'store/index.js'
import api from './api/index'
import floatObj from './utils/number.js'
import global from './mixin/mixin'
import userinfo from './mixin/user'
import CommonList from './components/common/list.vue'
import Empty from './components/common/empty.vue'
import pdfView from './components/common/pdfView.vue'
import pdfView2 from './components/common/pdfView2.vue'
import FixedBottom from './components/common/fixed-bottom.vue'
import BottomButton from '@/components/common/bottom-button'
import Watermark from '@/components/watermark/zmm-watermark'

Vue.config.productionTip = false

App.mpType = 'app'

Vue.prototype.$api = api
Vue.prototype.$floatObj = floatObj

Vue.component('BottomButton',BottomButton)
Vue.component('CommonList',CommonList)
Vue.component('Empty',Empty)
Vue.component('pdfView',pdfView)
Vue.component('pdfView2',pdfView2)
Vue.component('Watermark',Watermark)
Vue.component('FixedBottom',FixedBottom)

Vue.use(uView)
Vue.mixin(global)
Vue.mixin(userinfo)

Vue.mixin({
    mounted() {
        if (this.isWeiXinBrowser() || this.isQQBrowser()) {
            this.navTitle()
        }
    },
    methods: {
        isWeiXinBrowser() {
            let ua = navigator.userAgent.toLowerCase()
            return ua.indexOf('micromessenger') != -1
        },
        isQQBrowser() {
            var ua = navigator.userAgent.toLowerCase()
            if (ua.match(/QQ/i) == "qq") {
                return true
            } else {
                return false
            }
        },
        navTitle() {
            this.$nextTick(() => {
                let navTitleDom = document.getElementsByTagName('uni-page-head')
                if (navTitleDom.length) {
                    navTitleDom[0].style.display = 'none'
                }
            })
        }
    }
})
const app = new Vue({
  ...App,
  store
})
app.$mount()
